package com.rongshu.view.userInfo.presenter;

import android.content.Context;

import com.rongshu.api.RetorfitService;
import com.rongshu.view.base.mvp.BasePresenter;
import com.rongshu.view.base.mvp.INetBean;
import com.rongshu.view.userInfo.entity.CollectedWorkStatusCount;
import com.rongshu.view.userInfo.iview.CollectedWorkListView;

import rx.Subscriber;

public class CollectedWorkListPresenter extends BasePresenter<CollectedWorkListView> {

    public CollectedWorkListPresenter(Context context) {
        super(context);
    }

    /**
     * 获取我的文集里不同文章状态的数量
     */
    public void getStatusCount(int userId, int serializeId, String sign) {
        RetorfitService.getStatusCount(userId, serializeId, sign)
                .compose(getView().<CollectedWorkStatusCount>bindToLife())
                .subscribe(new Subscriber<CollectedWorkStatusCount>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(CollectedWorkStatusCount statusCount) {
                        if (getView() != null) {
                            getView().onStatusCount(statusCount);
                        }
                    }
                });
    }
}
